package com.hand.demo.app.service.Validator;

/*import com.fasterxml.jackson.databind.ObjectMapper;
import com.hand.demo.domain.entity.Example;
import org.hzero.boot.imported.infra.validator.annotation.ImportValidator;
import org.hzero.boot.imported.infra.validator.annotation.ImportValidators;
import javax.annotation.Resource;
import javax.xml.validation.ValidatorHandler;
import java.io.IOException;


@ImportValidators({
        @ImportValidator(templateCode = "EXAMPLE_CLIENT")
})*/
public abstract class Validator /*extends ValidatorHandler */{
/*    @Resource
    private ObjectMapper objectMapper;
    public boolean validate(String data) {
        Example example;// 获取自定义参数
        try {
            example = objectMapper.readValue(data, Example.class);
        } catch (IOException e) {
            return false;//失败
        }
        if (example.getId()==null) {
            throw new RuntimeException("id不能为空");
        }else if (example.getCode()==null){
            throw new RuntimeException("code不能为空");
        }else if (example.getName()==null){
            throw new RuntimeException("name不能为空");
        }
        return true;
    }*/
}
